package sctu.edu.java.year2016.team07.nieying.practice.dishirezhang;

import java.io.*;

/**
 * Created by Administrator on 2016/6/13 0013.
 */
public class Example1_0 {
    public static void main(String[] args){


        FileOutputStream fs= null;
        try {
            fs = new FileOutputStream("E:/my.txt");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        DataOutputStream ds=new DataOutputStream(fs);
        try {
            ds.writeUTF("写入数据");
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            ds.writeChars("写入数据");
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            ds.writeBytes("写入数据");
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            ds.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        FileInputStream fis= null;
        try {
            fis = new FileInputStream("D:/work.txt");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        DataInputStream dis=new DataInputStream(fis);
        try {
            System.out.println(dis.readUTF());
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
